﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FastLimitFlow
{
    public class LimitFactory
    {
        public  IRateLimit GetRateLimitController(RateLimitEnum LimitRule, int MaxTokenSize, int TokenProduceRate)
        {
            IRateLimit limit = null;
            switch (LimitRule)
            {
                case RateLimitEnum.TokenBucket:
                    limit = new TokenBucket(MaxTokenSize, TokenProduceRate);
                    break;
                case RateLimitEnum.LeakageBucket:
                    limit = new LeakageBucket(MaxTokenSize, TokenProduceRate);
                    break;

            }
            return limit;
        }

    }
}
